package com.bhs.sansonglogistics.dialog;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansonglogistics.R;
import com.bhs.sansonglogistics.utils.MyUtils;
import com.lxj.xpopup.core.CenterPopupView;

/**
 * 确认弹窗
 */
public class ConfirmDialog extends CenterPopupView {
    private MyClickListener listener;
    public ConfirmDialog(@NonNull Context context) {
        super(context);
    }

    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_confirm;
    }

    @Override
    protected void onCreate() {
        super.onCreate();
        findViewById(R.id.btn_confirm).setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                listener.onClick(view);
            }
        });
    }

    // 设置最大宽度，看需要而定，
    @Override
    protected int getMaxWidth() {
        return MyUtils.getScreenWidth(getContext())*9/10;
    }


    public void setMyClickListener(@Nullable MyClickListener l) {
        this.listener = l;
    }
}
